home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
7675
/
7675.xpi
/
chrome
/
wikilook
/
content
/
prefs.js
< prev
next >
Wrap
Text File
|
2009-11-01
|
7KB
|
94 lines
function initializeWLOptions() {
this.prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.");
// WikiLook Version
// document.getElementById("WikiLookVersionNumber").checked = prefs.getCharPref("WikiLook.WikiLookVersionNumber");
// WikiLook enabled?
// document.getElementById("WikiLook.WL_enabled").checked = prefs.getBoolPref("WikiLook.WL_enabled");
// Read audio automatically on popup load?
document.getElementById("WikiLookAutoAudioOption").checked = prefs.getBoolPref("WikiLook.WikiLookAutoAudio");
document.getElementById("WikiLookMainLanguageOption").value = prefs.getCharPref("WikiLook.WikiLookMainLanguage");
// Looking up Wikipedia/Wikttionary using only mouse?
document.getElementById("WikiLookMouselookCheckboxOption").checked = prefs.getBoolPref("WikiLook.WikiLookMouselookEnabled");
// If yes, what parser should we use? Could be "native" or actual URL to the site containing wikicode, example "http:\\fr.wiktionary.org"
document.getElementById("WikiLookMouselookParserOption").value = prefs.getCharPref("WikiLook.WikiLookMouselookParser");
document.getElementById("WikiLookMouselookSmartLookupOption").checked = prefs.getBoolPref("WikiLook.WikiLookMouselookSmartLookupEnabled");
// Shift key lookup enabled?
document.getElementById("WikiLookShiftCheckboxOption").checked = prefs.getBoolPref("WikiLook.WikiLookShiftEnabled");
// If yes, what parser should we use? Could be "native" or actual URL to the site containing wikicode, example "http:\\fr.wiktionary.org"
document.getElementById("WikiLookShiftParserOption").value = prefs.getCharPref("WikiLook.WikiLookShiftParser");
document.getElementById("WikiLookShiftSmartLookupOption").checked = prefs.getBoolPref("WikiLook.WikiLookShiftSmartLookupEnabled");
// Ctrl key lookup enabled?
document.getElementById("WikiLookCtrlCheckboxOption").checked = prefs.getBoolPref("WikiLook.WikiLookCtrlEnabled");
// Only site URL for ctrl parser.
document.getElementById("WikiLookCtrlParserOption").value = prefs.getCharPref("WikiLook.WikiLookCtrlParser");
document.getElementById("WikiLookCtrlSmartLookupOption").checked = prefs.getBoolPref("WikiLook.WikiLookCtrlSmartLookupEnabled");
// Alt key lookup enabled?
document.getElementById("WikiLookAltCheckboxOption").checked = prefs.getBoolPref("WikiLook.WikiLookAltEnabled");
// Only site URL for Alt parser.
document.getElementById("WikiLookAltParserOption").value = prefs.getCharPref("WikiLook.WikiLookAltParser");
document.getElementById("WikiLookAltSmartLookupOption").checked = prefs.getBoolPref("WikiLook.WikiLookAltSmartLookupEnabled");
document.getElementById("divOverWikiLinksEnabledOption").checked = prefs.getBoolPref("WikiLook.divOverWikiLinksEnabled");
document.getElementById("divOverWikiLinksDelayOption").value = prefs.getIntPref("WikiLook.divOverWikiLinksDelay");
}
function saveWLOptions() {
this.prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.");
// prefs.setBoolPref("WikiLook.WL_enabled", document.getElementById("WL_enabledOption").checked);
prefs.setBoolPref("WikiLook.WikiLookAutoAudio", document.getElementById("WikiLookAutoAudioOption").checked);
prefs.setBoolPref("WikiLook.WikiLookMouselookEnabled", document.getElementById("WikiLookMouselookCheckboxOption").checked);
prefs.setCharPref("WikiLook.WikiLookMouselookParser", document.getElementById("WikiLookMouselookParserOption").value);
prefs.setBoolPref("WikiLook.WikiLookMouselookSmartLookupEnabled", document.getElementById("WikiLookMouselookSmartLookupOption").checked);
prefs.setBoolPref("WikiLook.WikiLookShiftEnabled", document.getElementById("WikiLookShiftCheckboxOption").checked);
prefs.setCharPref("WikiLook.WikiLookShiftParser", document.getElementById("WikiLookShiftParserOption").value);
prefs.setBoolPref("WikiLook.WikiLookShiftSmartLookupEnabled", document.getElementById("WikiLookShiftSmartLookupOption").checked);
prefs.setBoolPref("WikiLook.WikiLookCtrlEnabled", document.getElementById("WikiLookCtrlCheckboxOption").checked);
prefs.setCharPref("WikiLook.WikiLookCtrlParser", document.getElementById("WikiLookCtrlParserOption").value);
prefs.setBoolPref("WikiLook.WikiLookCtrlSmartLookupEnabled", document.getElementById("WikiLookCtrlSmartLookupOption").checked);
prefs.setBoolPref("WikiLook.WikiLookAltEnabled", document.getElementById("WikiLookAltCheckboxOption").checked);
prefs.setCharPref("WikiLook.WikiLookAltParser", document.getElementById("WikiLookAltParserOption").value);
prefs.setBoolPref("WikiLook.WikiLookAltSmartLookupEnabled", document.getElementById("WikiLookAltSmartLookupOption").checked);
prefs.setCharPref("WikiLook.WikiLookMainLanguage", document.getElementById("WikiLookMainLanguageOption").value);
prefs.setBoolPref("WikiLook.divOverWikiLinksEnabled", document.getElementById("divOverWikiLinksEnabledOption").checked);
prefs.setIntPref("WikiLook.divOverWikiLinksDelay", document.getElementById("divOverWikiLinksDelayOption").value);
prefs.setBoolPref("WikiLook.WL_enabled", true);
return true;
}
function setWLDefaults() {
document.getElementById("WikiLookAutoAudioOption").checked = true;
document.getElementById("WikiLookMouselookCheckboxOption").checked = false;
document.getElementById("WikiLookMouselookParserOption").value = 'native';
document.getElementById("WikiLookMouselookSmartLookupOption").checked = false;
document.getElementById("WikiLookShiftCheckboxOption").checked = true;
document.getElementById("WikiLookShiftParserOption").value = 'native';
document.getElementById("WikiLookShiftSmartLookupOption").checked = false;
if(window.navigator.userAgent.indexOf("Mac OS")!=-1) {
document.getElementById("WikiLookCtrlCheckboxOption").checked = false;
document.getElementById("WikiLookCtrlParserOption").value = 'http://uncyclopedia.wikia.com';
document.getElementById("WikiLookAltParserOption").value = 'http://en.wikipedia.org';
} else {
document.getElementById("WikiLookCtrlCheckboxOption").checked = true;
document.getElementById("WikiLookCtrlParserOption").value = 'http://en.wikipedia.org';
document.getElementById("WikiLookAltParserOption").value = 'http://uncyclopedia.wikia.com';
}
document.getElementById("WikiLookCtrlSmartLookupOption").checked = true;
document.getElementById("WikiLookAltCheckboxOption").checked = true;
document.getElementById("WikiLookAltSmartLookupOption").checked = true;
document.getElementById("WikiLookMainLanguageOption").value = 'English';
document.getElementById("divOverWikiLinksEnabledOption").checked = true;
document.getElementById("divOverWikiLinksDelayOption").value = 2000;
}